<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <nav class="navbar navbar-default">
                            <div class="collapse navbar-collapse">
                                <div class="navbar-form row">
                                    <!--<div class="col-md-1">-->
                                        <!--<button class="btn bg-navy" type="button" onclick="tree_open(this);"><i class="fa fa-angle-double-down"></i>展开</button>-->
                                    <!--</div>-->
                                    <div class="col-md-9">
                                        <!--<span class="warning">温馨提示：顶级分类（一级大类）设为推荐时才会在首页楼层中显示</span>-->
                                    </div>
                                    <div class="col-md-2">
                                        <a href="{:U('Lottery/addCate')}" class="btn btn-primary pull-right" data-toggle='tooltip'data-original-title="新增分类"><i class="fa fa-plus"></i>新增分类</a>
                                    </div>
                                </div>
                            </div>
                        </nav>
                    </div><!-- /.box-header -->
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
                                    <thead>
                                    <tr role="row">
                                        <th valign="middle">分类ID</th>
                                        <th valign="middle">分类名称</th>
                                        <th valign="middle">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <foreach name="lotteryCategoryData" item="vo" key="k" >
                                        <tr role="row">
                                        <td>{$vo.id}</td>
                                        <td>
                                            <span>{$vo.category_name}</span>
                                        </td>
                                        <td>
                                            <a class="btn btn-primary" href="{:U('Lottery/addCate',array('id'=>$vo['id']))}" data-toggle='tooltip'data-original-title="修改"><i class="fa fa-pencil"></i></a>
                                            <a class="btn btn-danger cate_del" data-id="{$vo.id}" data-toggle='tooltip'data-original-title="删除">	<i class="fa fa-trash-o"></i></a>
                                        </td>
                                        </tr>
                                    </foreach>
                                    </tbody>
                                </table></div></div>
                        <div class="row">
                            <div class="col-sm-5">
                                <!--<div class="dataTables_info" id="example1_info" role="status" aria-live="polite">分页</div></div>                                   -->
                            </div>
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div>
            </div>
    </section>
</div>
<script type="text/javascript">
    $(function () {
        $(document).on("click",'.cate_del',function () {
            var id = $(this).data('id');
            if(confirm('确认删除')){
                $.ajax({
                    type:'post',
                    url:'/index.php?m=Admin&c=Lottery&a=delCate',
                    data:{id:id},
                    dataType:'json',
                    success:function (res) {
                        if(res.result == 200 || res.result == '200'){
                            history.go(0);
                        }else{
                            layer.msg(res.message, {icon: 2,time: 1000});
                        }
                    }
                })
            }
        })
    })
</script>
</body>
</html>
